
package ProOF.apl.problems.real.functions;

import ProOF.com.LinkerParameters;
import java.lang.Math;
/**
 *
 * @author Lucas
 */
public class RealFuncMR extends aRealFunction{
	
	private double t[] = {1.0, 2.0, 1.0, 2.0, 1.0};
	private double v[] = {1.0, 1.0, 2.0, 2.0, 0.0};
	private double y[] = {0.126, 0.219, 0.076, 0.126, 0.186};
	@Override
	public void parameters(LinkerParameters link) throws Exception {

	}
	
	@Override
	public int dimension() {
		return 3;
	}
	
	@Override
	public double min( int i ) {
		return -10;
	}
	
	@Override
	public double max( int i ) {
		return 10;
	}

	@Override
	public double f(double[] x) throws Exception {
		check(x);
		double sum = 0;
		for (int i = 0; i < 5; i++) {
			sum += Math.pow((x[0]*x[2]*t[i])/(1 + x[0]*t[i]+ x[1]*v[i]) - y[i], 2);
		}
		return sum;
	}

	@Override
	public String name() {
		return "MR";
	}

	@Override
	public String description() {
		return "Meyer and Roth Problemd";
	}	
}
